package com.situ.day2;

import java.util.Scanner;
import java.util.concurrent.SynchronousQueue;

import org.junit.Test;

public class SwitchDemo {
	
	@Test
	public void test1() {
		int type = 2;
		switch (type) {
		case 1:
			System.out.println("1");
			break;
		case 2:
			System.out.println("2");
			break;
		case 3:
			System.out.println("3");
			break;
		case 4:
			System.out.println("4");
			break;
		default:
			System.out.println("default: " + type);
			break;
		}
	}
	
	@Test
	public void test33() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入月份：");
		int month = scanner.nextInt();
		
		if (month < 0 || month > 12) {
			System.out.println("输入的月份非法");
			return;
		}
		
		switch (month) {
		case 1:
		case 3:
		case 5:
		case 7:
		case 8:
		case 10:
		case 12:
			System.out.println("31天");
			break;
		case 4:
		case 6:
		case 9:
		case 11:
			System.out.println("30天");
			break;
		case 2:
			//让用户输入输入年份，根据是不是闰年判断有多少天
			break;
		default:
			break;
		}
	}
	
	@Test
	public void test333() {
		Scanner scanner = new Scanner(System.in);
		System.out.println("请输入学生的成绩：");
		int score = scanner.nextInt();
		if (score < 0 || score > 100) {
			System.out.println("输入非法");
			return;
		}
		
		switch (score / 10) {
		case 9:
		case 10:
			System.out.println("优秀");
			break;
		case 8:
			System.out.println("良好");
			break;
		case 7:
			System.out.println("一般");
			break;
		case 6:
			System.out.println("及格");
			break;
		default:
			System.out.println("不及格");
			break;
		}
	}
	
	
	
	
}
